﻿<!--#Include File="../Inc/Const.Asp"-->
<!--#Include File="Inc/Class_Form.Asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>文档模型管理</title>
<script language="JavaScript" type="text/javascript" src="Images/ajax.js"></script>
<link href="Images/Style.Css" rel="stylesheet" type="text/css" />
</head>
<body>
<%

Dim U
Set U = New Cls_Form

Dim Rs,Ns,Sql,Style,i
Dim ID
    ID = Request("ID")

Select Case Request("Act")
Case "Guide"
	If Len(ID) = 0 Then
		Call U.Initialize()
		Call Main_Guide(0)
	Else
		U.vID = ID
		Call U.SetValue()
		Call Main_Guide(1)
	End If
Case "UpDate"
	If U.GetValue() Then
		If Len(ID) = 0 Then
			If Not U.Create() Then
				Alert U.LastError,"Admin_Form.Asp"
			Else
				Alert "","Admin_Form.Asp"
			End If
		Else
			U.vID = ID
			If Not U.Modify() Then
				Alert U.LastError,"Admin_Form.Asp"
			Else
				Alert "","Admin_Form.Asp?Page="
			End If
		End If
	Else
		Alert U.LastError,"Admin_Form.Asp?Page="
	End If
Case "Delete"
	If Len(ID) > 0 Then
		U.vID = ID
		If Not U.Delete() Then
			Alert U.LastError,"Admin_Form.Asp?Page="
		Else
			Alert "","Admin_Form.Asp?Page="
		End If
	Else
		Call Main()
	End If
Case Else
	Call Main()
End Select

Set U = Nothing
If IsObject(Conn) Then Conn.Close : Set Conn = Nothing

Sub Main()


Set Rs = New DataList
Rs.Field = "[ID],[Name],[Status],[DateTime],[Order]"
Rs.Table = "[{pre}UserForm]"
Rs.Where = SQL
Rs.List()
%>
<table width=100% border=0 cellpadding=3 cellspacing=1 class=css_table bgcolor='#E1E1E1'>
	<tr class=css_menu>
		<td colspan=8><table width=100% border=0 cellpadding=4 cellspacing=0 class=css_main_table>
					<tr>
						<td class=css_main><a href=Admin_Form.Asp>文档模型列表</a> <a href=Admin_Form.Asp?Act=Guide>新建文档模型</a></td>
						<td class=css_search>&nbsp;</td>
					</tr>
			</table></td>
	</tr>
		<tr>
			<td width="48" class='css_top'>编号</td>
			<td width="428" class='css_top'>模型名称</td>
			<td width="195" class='css_top'>启用状态</td>
			<td width="188" class='css_top'>添加时间</td>
			<td width="123" class='css_top'>显示顺序</td>
			<td width="221" class='css_top'>管理</td>
		</tr>
		<%
		If Rs.Eof Then
		%>
		<tr align="center" class=css_norecord>
			<td colspan=8>没有任何记录！</td>
		</tr>
		<%
		Else
		For i = 0 To UBound(Rs.Data,2)
		%>
		<tr>
			<td width="48" class='css_list'><%=Rs.Data(0,i)%></td>
			<td class='css_list'><div align="left"> &nbsp;<a href="Admin_Form.Asp?Act=Guide&ID=<%=Rs.Data(0,i)%>"><%=Rs.Data(1,i)%></a></div></td>
		  <td width="195" class='css_list'><%If Rs.Data(2,i)=1 Then response.Write "启用" else response.Write "关闭"%></td>
			<td width="188" class='css_list'><%=Rs.Data(3,i)%></td>
			<td width="123" class='css_list'><%=Rs.Data(4,i)%></td>
			<td width="221" class='css_list'><input name=addfield type=button onclick="location.href='Admin_Field.Asp?FID=<%=Rs.Data(0,i)%>';" value=字段>
			<input name=modify type=button onclick="location.href='Admin_Form.Asp?Act=Guide&ID=<%=Rs.Data(0,i)%>';" value=修改>
		  <input name=delete type=button onclick="if(confirm('您确定要删除这条记录吗?')){location.href='Admin_Form.Asp?Act=Delete&ID=<%=Rs.Data(0,i)%>';}" value=删除></td>
		</tr>
		<%
		Next
		End If
		%>
</table>
<%
Set Rs = Nothing
End Sub

Sub Main_Guide(T)
%>
<table width=100% border=0 cellpadding=3 cellspacing=1 class=css_table bgcolor='#E1E1E1'>
	<tr class=css_menu>
		<td colspan=3><table width=100% border=0 cellpadding=4 cellspacing=0 class=css_main_table>
				<tr>
					<td class=css_main><a href=Admin_Form.Asp>文档模型管理</a></td>
				</tr>
			</table></td>
	</tr>
	<form name='frm' id="frm" method='post' action='Admin_Form.Asp?Act=UpDate&ID=<%=ID%>'>
		
		<tr>
			<td width="138" class=css_col11_content><div align="right"> <font color=red>模型名称：</font> </div></td>
			<td width="1157" colspan="2" class=css_col21><input name="oName" type="text" class="css_input" id="oName" value="<%=U.vName%>" size="40" /></td>
		</tr>
		<tr>
		  <td class=css_col11_content><div align="right"> <font color="red">启用状态：</font> </div></td>
		  <td colspan="2" class=css_col21><input name="oStatus" type="radio" id="oStatus" value="1" checked="checked" />
		    默认开启
              <input name="oStatus" type="radio" id="oStatus" value="0" />
          默认关闭 </td>
	  </tr>
		<tr>
			<td class=css_col11_content><div align="right"> <font color=red>显示顺序：</font> </div></td>
			<td colspan="2" class=css_col21><input type="text" name="oOrder" id="oOrder" value="0" size="10" /></td>
		</tr>
		<tr class=css_page_list>
			<td colspan=3><input name='Submit' type='submit' value='保存'>			</td>
		</tr>
	</form>
</table>
</div>
<%
End Sub
%>
</body>
</html>
